<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:csharp="http://csharp.org" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
  <msxsl:script language="CSharp" implements-prefix="csharp">

    <![CDATA[
      public string FormatDateTime(string dateString)
      {
        if (dateString != null)
        {
          try
          {
            DateTime t = DateTime.Parse(dateString).ToLocalTime();
            string tz = System.TimeZoneInfo.Local.IsDaylightSavingTime(t) ? "EDT" : "EST";
          
            return t.ToString(string.Format("MMMM d, yyyy 'at' h:mm:ss tt '{0}'", tz));
          }
          catch
          {
            return dateString;
          }
        }
        return string.Empty;
      }
    ]]>
  </msxsl:script>
</xsl:stylesheet>

